/**
 * Description 对token进行操作
 */
import Cookies from 'js-cookie';

const TokenKey = 'Admin-Token';

/**
 * 获得token
 * @returns {*|ActiveX.IXMLDOMNode|Promise<any>|string|IDBRequest<any>|MediaKeyStatus|FormDataEntryValue|Function|Promise<Credential | null>}
 */
export function getToken() {
  // return "1";
  // return window.localStorage.getItem(TokenKey);
  return Cookies.get(TokenKey);
}

/**
 * 设置token
 * @param token
 * @returns {*}
 */
export function setToken(token) {
  // return window.localStorage.setItem(TokenKey, token);
  return Cookies.set(TokenKey, token);
}

/**
 * 清除token
 * @returns {void|Promise<void>}
 */
export function removeToken() {
  // return window.localStorage.removeItem(TokenKey);
  return Cookies.remove(TokenKey);
}
